home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
comnumb.exe
/
RTST.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-01
|
2KB
|
54 lines
/////////////////////////////////////////////////////////
// rtst.cpp: Test program for rational number class
// Copyright(c) 1992 Azarona Software
/////////////////////////////////////////////////////////
#include <iostream.h>
#include "rational.h"
main()
{
Rational x, y, z;
while(1) {
cout << "Enter first rational number (w or <n/d>): ";
cin >> x;
if (cin) {
cout << "Enter second rational number (w or <n/d>): ";
cin >> y;
}
if (cin) {
cout << "-" << x << " = " << (-x) << '\n';
cout << "-" << y << " = " << (-y) << '\n';
cout << "+" << x << " = " << (+x) << '\n';
cout << "+" << y << " = " << (+y) << '\n';
cout << x << " * " << y << " = " << (x * y) << '\n';
cout << x << " / " << y << " = " << (x / y) << '\n';
cout << x << " + " << y << " = " << (x + y) << '\n';
cout << x << " - " << y << " = " << (x - y) << '\n';
cout << x << " == " << y << " = " << (x == y) << '\n';
cout << x << " != " << y << " = " << (x != y) << '\n';
cout << x << " <= " << y << " = " << (x <= y) << '\n';
cout << x << " >= " << y << " = " << (x >= y) << '\n';
cout << x << " < " << y << " = " << (x < y) << '\n';
cout << x << " > " << y << " = " << (x > y) << '\n';
cout << x << "++ = ";
z = x++;
cout << z << '\n';
cout << x << "-- = ";
z = x--;
cout << z << '\n';
cout << "++" << x << " = ";
z = ++x;
cout << z << '\n';
cout << "--" << x << " = ";
z = --x;
cout << z << '\n';
}
else {
cout << "That's not very rational!\n";
break;
}
}
return 0;
}